An EEPROM (electrically erasable, programmable, read-only memory) and a flash memory are nonvolatile memories, which are able to be used in microcontrollers of control units, computers or other electronic units. Data stored in these nonvolatile memories are retained even when a power supply of the nonvolatile memory is interrupted. EEPROMs have some advantages over flash memories. In an EEPROM, individual bytes may be individually and flexibly written to and erased. In flash memories, on the other hand, data are only able to be erased as data blocks of several kilobytes. However, EEPROMs are more cost-intensive and require more space than flash memories. Therefore, one is able to take advantage of the possibility of emulating an EEPROM in a flash memory.
Such an emulated EEPROM may be divided into several sectors, a sector representing the smallest erasable unit. Each sector, in turn, may be subdivided into several pages, a page forming the smallest writable unit. Stored data blocks may occupy one or more pages, in this context. In this context, a sector is written to consecutively from the sector beginning to the sector end with data blocks, until the respective sector is full. When the respective sector is full, a subsequent sector is written to in analogous fashion.
Usually, several different data blocks are stored. One current version of a respective data block, in this context, is written to the next free page of the current sector. From each of the plurality of different data blocks there may thus exist different versions. Accordingly, in one sector, several versions of the same data block may be stored, the different versions of the data block having been set up at different times. A position of a particular version of a particular data block in one sector therefore indicates the current status of this version of the data block.
When the current, last stored version of a particular data block is being searched for, one may first search through a current, not yet fully written to sector from sector beginning to sector end. Since the position of a version of the particular data block in the sector indicates the current status, the sector always has to be searched from sector beginning to sector end. If the version searched for in the current sector is not found, a logically preceding sector is searched in the same manner. This process may be continued until the current version of the data block has been found. In some instances it may thus take a long time until the current version is found, since under certain circumstances a plurality of sectors has to be searched.
Furthermore, it is problematic in this context, that this search mode has to be repeated before each reading and writing process of a data block. If a particular data block is to be read in, its current version has to be searched for first. If a data block is to be written, for the protection of flash memories, also the current version of the data block is first searched for, since writing processes take place only in response to a change in the data block. Reading and writing processes of an emulated EEPROM therefore take up much time. This leads particularly to long runup times and bringing down times which should be avoided in particular with control units in motor vehicles, which often also fulfill safety-relevant functions.
It is therefore desirable to provide a possibility of reading in data blocks in a flash-emulated EEPROM rapidly and without great effort.